# este script asume 4 parametros para el ejecutable UdpStdClient
args=("$@")
# ip Linker
ip="10.42.0.1"
port="7755"
#echo ${args[0]}

if [ ${args[0]} -eq 1 ]; then
#echo "figura circular desde Wiracocha"
str="UdPbC \s:WI0002,n:123*21\$WRFCS,F,012,VARAYOC2,012 31.05S,078 15.05W,0,3000,0,350,A10,000000,1,5,A0A0A4,1*52\r\n\$WRFCS,F,013,VARAYOC,012 31.05S,078 15.05W,0,3000,0,350,A11,000000,1,5,A0A0A4,1*60\r\n\$WRFCS,F,001,VARAYOC4,012 31.05S,078 15.05W,0,3000,0,350,A15,000000,1,5,A0A0A4,1*53\r\n"
fi
#UdPbC \s:WI0002,n:123*21$WRFCS,F,012,VARAYOC2,012 31.05S,078 15.05W,0,3000,0,350,A10,000000,1,5,A0A0A4,1*52\r\n$WRFCS,F,013,VARAYOC,012 31.05S,078 15.05W,0,3000,0,350,A11,000000,1,5,A0A0A4,1*60\r\n$WRFCS,F,001,VARAYOC4,012 31.05S,078 15.05W,0,3000,0,350,A15,000000,1,5,A0A0A4,1*53\r\n

if [ ${args[0]} -eq 2 ]; then
#echo "emision de mage desde Wiracocha"
str="UdPbC \s:WI0002,d:VA0001,n:126*40\$WRESM,011,VARAYOC2,11110,Q,000 00.00N,111 11.11W,87.9,1000,0,-10.0,0.10,100.0,3,60,20120612005730.5*5F\r\n\$WRESM,012,VARAYOC,11110,Q,000 00.00N,111 11.11W,87.9,1000,0,-10.0,0.10,100.0,3,60,20120612165730.5*6E\r\n"
fi

if [ ${args[0]} -eq 3 ]; then
#echo "figura poligonal desde Wiracocha"
str="UdPbC \s:WI0002,d:VA0001,n:132*45\$WRFPS,F,012,VARAYOC2,C,A10,000000,1,5,3,012 32.05S,078 15.05W,011 31.05S,077 15.05W,013 31.05S,079 15.05W,A0A0A4,1*0B\r\n\$WRFPS,F,015,VARAYOC4,C,A10,000000,1,5,3,012 32.05S,078 15.05W,011 31.05S,077 15.05W,013 31.05S,079 15.05W,A0A0A4,1*0A\r\n"
fi

if [ ${args[0]} -eq 4 ]; then
#echo "mensaje erroneo 1"
str="cadena desconocida......\$WRFCS"
fi

if [ ${args[0]} -eq 5 ]; then
#echo "respuesta desde Wiracocha a Linker por el datagrama 000"
str="UdPbC \s:WI0001,d:VA0001,n:005*43\$WIACK,000*4B\r\n"
fi

if [ ${args[0]} -eq 6 ]; then
#echo "respuesta desde Wiracocha a Linker por el datagrama 001"
str="UdPbC \s:WI0001,d:VA0001,n:010*47\$WIACK,001*4A\r\n"
fi

if [ ${args[0]} -eq 7 ]; then
#echo "respuesta desde Wiracocha a Linker por el datagrama 002"
str="UdPbC \s:WI0001,d:VA0001,n:018*4F\$WIACK,002*49\r\n"
fi

if [ ${args[0]} -eq 8 ]; then
#echo "primer mensaje de heartbeat enviado por wiracocha"
str="UdPbC \s:WI0001,d:VA0001,n:018*4F\$WIHBT,60,A,1*1A\r\n"
fi

if [ ${args[0]} -eq 9 ]; then
#echo "segundo mensaje de heartbeat enviado por wiracocha"
str="UdPbC \s:WI0001,d:VA0001,n:019*4E\$WIHBT,60,V,3*0F\r\n"
fi

if [ ${args[0]} -eq 10 ]; then
#echo "tercer mensaje de heartbeat enviado por wiracocha"
str="UdPbC \s:WI0001,d:VA0001,n:020*44\$WIHBT,60,A,7*1C\r\n"
fi

if [ ${args[0]} -eq 11 ]; then
#echo "los 3 mensajes de track desde Wiracocha para el datagrama 018, no encuentro el nombre de la unidad en la tabla"
str="UdPbC \s:WI0001,d:VA0001,n:018*4F\$WITLL,001,1210.99999,S,07707.99999,W,TARGET1,133609.48,T,*3E\r\n\$WITTM,001,0.2,0.3,T,0.5,0.6,T,0.8,0.9,N,TARGET1,Q,,133609.48,A*1F\r\n\$PC4C,001,02,03,2525B,0.5,0.6,0.7,08,09*11\r\n"
fi

if [ ${args[0]} -eq 12 ]; then
#echo "los 3 mensajes de track desde Wiracocha para el datagrama 019, checksum incorrecto"
str="UdPbC \s:WI0001,d:VA0001,n:019*4E\$WITLL,001,1210.99999,S,07707.99999,W,TARGET1,133609.48,T,*3E\r\n\$WITTM,001,0.2,0.3,T,0.5,0.6,T,0.8,0.9,N,TARGET1,Q,,133609.48,A*1F\r\n\$PC4C,001,02,03,2525B,0.5,0.6,0.7,08,09*12\r\n"
fi

if [ ${args[0]} -eq 13 ]; then
#echo "los 3 mensajes de track desde Wiracocha para el datagrama 020, correcto"
str="UdPbC \s:WI0001,d:VA0001,n:020*44\$WITLL,010,1210.99999,S,07707.99999,W,TARGET1,133609.48,T,*3E\r\n\$WITTM,010,0.2,0.3,T,0.5,0.6,T,0.8,0.9,N,TARGET1,Q,,133609.48,A*1F\r\n\$PC4C,010,02:01,CARBAJAL,2525B,0.5,0.6,0.7,08,09*3D\r\n"
fi

#echo ${args[0]} ${args[1]} ${args[2]} ' -> args=("$@"); echo ${args[0]} ${args[1]} ${args[2]}'
#str01="\$WRFCS,F,012,VARAYOC2,012 31.05S,078 15.05W,0,3000,0,350,A10,000000,1,5,A0A0A4,1*52\r\n"
#str02="UdPbC \s:WI0003,n:123*20\$WRFCS,F,012,VARAYOC2,012 31.05S,078 15.05W,0,3000,0,350,A10,000000,1,5,A0A0A4,1*52\r\n\$WRFCS,F,013,VARAYOC2,012 31.05S,078 15.05W,0,3000,0,350,A10,000000,1,5,A0A0A4,1*53\r\n"
#echo $str01
/home/rmartinez/dosmildoce/UdpStdClient/UdpStdClient $ip $port "$str"

#/home/rmartinez/dosmildoce/UdpStdClient/UdpStdClient 192.168.1.36 7755 "\$WRFCS,F,012,VARAYOC2,012 31.05S,078 15.05W,0,3000,0,350,A10,000000,1,5,A0A0A4,1*52\r\n"
